1. Technical Field
This invention generally relates to object oriented programming and more specifically relates to an apparatus and method for allocating and freeing storage elements in an object oriented computer system.
2. Background Art
The development of the EDVAC computer system of 1948 is often cited as the beginning of the computer era. Since that time, computer systems have evolved into extremely sophisticated devices, and computer systems may be found in many different settings. Computer systems typically include a combination of hardware (e.g., semiconductors, circuit boards, etc.) and software (e.g., computer programs). As advances in semiconductor processing and computer architecture push the performance of the computer hardware higher, more sophisticated computer software has evolved to take advantage of the higher performance of the hardware, resulting in computer systems today that are much more powerful than just a few years ago.
Computer systems typically include operating system software that controls the basic function of the computer, and one or more software application programs that run under the control of the operating system to perform desired tasks. For example, a typical IBM Personal Computer may run the OS/2 operating system, and under the control of the OS/2 operating system, a user may execute an application program, such as a word processor. As the capabilities of computer systems have increased, the application software programs designed for high performance computer systems have become extremely powerful. Additionally, software development costs have continued to rise because more powerful and complex programs take more time, and hence more money, to produce.
One way in which the performance of application software programs has been improved while the associated development costs have been reduced is by using object-oriented programming concepts. The goal of using object-oriented programming is to create small, reusable sections of program code known as "objects" that can be quickly and easily combined and re-used to create new programs. This is similar to the idea of using the same set of building blocks again and again to create many different structures. The modular and re-usable aspects of objects will typically speed development of new programs, thereby reducing the costs associated with the development cycle. In addition, by creating and re-using a comprehensive set of well-tested objects, a more stable, uniform, and consistent approach to developing new computer programs can be achieved.
A central concept in object-oriented programming is the "class." A class is a template that defines a type of object. A class outlines or describes the characteristics or makeup of objects that belong to that class. By defining a class, objects can be created that belong to the class without having to rewrite the entire definition for each new object as it is created. This feature of object-oriented programming promotes the reusability of existing object definitions and promotes more efficient use of program code.
When an object is created in an object oriented system, it is created as an instance of a particular class. Object oriented languages typically define methods on a class that create and delete objects when the methods are invoked. The creation of an object typically involves two operations: 1) allocating storage for the object, and 2) invoking the constructor method on the class, which creates the instance of the class in the allocated storage.
Most object oriented computer systems include a "heap", which is a relatively large storage area that may be allocated in smaller pieces as needed. In the prior art, when an object needs to be created, a storage element must typically be retrieved from the heap. The object can then be created using the storage element. However, the act of retrieving storage from the heap generally takes a relatively long time, resulting in substantial performance penalties when a storage element is allocated for an object. Furthermore, accesses to storage elements must be serialized on both multi-threaded and/or multi-processor systems. Serializing access to storage elements assures that one storage element cannot be allocated to two different processors or threads. For example, without serialization, it would be possible for two threads to check the storage pool and determine that the same storage element is available, but the storage element can only be allocated to one of the threads. Serialization is the technique used to assure that a storage element can only be allocated to one thread or process.
Storage pools were introduced as a mechanism to cache storage elements from the heap to improve the performance of a computer system by allowing relatively quick retrieval of a storage element from the storage pool rather than performing a much longer access to the heap. This approach provides storage elements that are resident in storage that may be more quickly accessed than the heap, but serialization methods must still be employed. Some programs cannot tolerate the performance penalty of cache misses. One example is a device driver running in a privileged state that must manage steady, uninterruptible (e.g., isochronous) data flows, such as the data flow to the sound system or monitor of a computer system, which cannot have breaks that are perceptible to the end user. The thread managing the device driver's data flow must be able to have storage allocated to it in a manner that does not create unacceptable breaks in the data stream. A thread that must wait for paging to complete for non-resident heap storage due to a cache miss would have difficulty maintaining uninterrupted data flows. Known serialization and storage allocation techniques do not provide the needed performance. Without a mechanism for quickly and efficiently allocating storage for object creation in a serial manner, the computer industry will continue to suffer from performance penalties due to the excessive time it takes to serialize and allocate storage each time an object is created.